package com.cff.action;

import java.awt.Component;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Properties;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;

import com.cff.AwtPos;
import com.cff.common.Constant;
import com.cff.common.SimpleFrame;
import com.cff.util.EventUtil;
import com.cff.util.FileUtil;
import com.cff.util.SignTools;

public class ProjectSktActionListener implements ActionListener {
	private static Properties confPro = null;
	SimpleFrame frame;
	Panel controlPanel;
	int colWeith = 200;
	
	JLabel labelMsgType ;
	JTextField textMsgType ;
	JLabel labelTranType ;
	JTextField textTranType ;
	JLabel labelTraceNum ;
	JTextField textTraceNum ;
	JLabel labelLocalTime ;
	JTextField textLocalTime ;
	JLabel labelLocalDate ;
	JTextField textLocalDate ;
	JLabel label41 ;
	JTextField text41 ;
	JLabel label42 ;
	JTextField text42 ;
	
	JLabel label48 ;
	
	JLabel label48_00 ;
	JTextField text48_00 ;
	JLabel label48_08 ;
	JTextField text48_08 ;
	JLabel label48_09 ;
	JTextField text48_09 ;
	JLabel label48_26 ;
	JTextField text48_26 ;
	JLabel label48_44 ;
	JTextField text48_44 ;
	JButton sktButton ;
	JButton addSktMsgButton;
	JButton addSktMsg48Button;
	
	public ProjectSktActionListener(Panel controlPanel) {
		super();
		this.controlPanel = controlPanel;
		confPro = FileUtil.getInstance();
	}

	public ProjectSktActionListener(SimpleFrame frame,Panel controlPanel) {
		super();
		this.frame = frame;
		this.controlPanel = controlPanel;
		confPro = FileUtil.getInstance();
	}
	
	public ProjectSktActionListener(SimpleFrame frame, Panel controlPanel, JLabel labelMsgType,
			JTextField textMsgType, JLabel labelTranType, JTextField textTranType, JLabel labelTraceNum,
			JTextField textTraceNum, JLabel labelLocalTime, JTextField textLocalTime, JLabel labelLocalDate,
			JTextField textLocalDate, JLabel label41, JTextField text41, JLabel label42, JTextField text42,
			JLabel label48, JLabel label48_00, JTextField text48_00, JLabel label48_08, JTextField text48_08,
			JLabel label48_09, JTextField text48_09, JLabel label48_26, JTextField text48_26, JLabel label48_44,
			JTextField text48_44, JButton sktButton,JButton addSktMsgButton,JButton addSktMsg48Button) {
		super();
		this.frame = frame;
		this.controlPanel = controlPanel;
		this.labelMsgType = labelMsgType;
		this.textMsgType = textMsgType;
		this.labelTranType = labelTranType;
		this.textTranType = textTranType;
		this.labelTraceNum = labelTraceNum;
		this.textTraceNum = textTraceNum;
		this.labelLocalTime = labelLocalTime;
		this.textLocalTime = textLocalTime;
		this.labelLocalDate = labelLocalDate;
		this.textLocalDate = textLocalDate;
		this.label41 = label41;
		this.text41 = text41;
		this.label42 = label42;
		this.text42 = text42;
		this.label48 = label48;
		this.label48_00 = label48_00;
		this.text48_00 = text48_00;
		this.label48_08 = label48_08;
		this.text48_08 = text48_08;
		this.label48_09 = label48_09;
		this.text48_09 = text48_09;
		this.label48_26 = label48_26;
		this.text48_26 = text48_26;
		this.label48_44 = label48_44;
		this.text48_44 = text48_44;
		this.sktButton = sktButton;
		this.addSktMsgButton = addSktMsgButton;
		this.addSktMsg48Button = addSktMsg48Button;
		confPro = FileUtil.getInstance();
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		confPro = FileUtil.getInstance();
		frame.setBounds(10, 10, AwtPos.SKTWEITH, AwtPos.SKTHEIGH);
		controlPanel.removeAll();
		controlPanel.removeNotify();
		controlPanel.addNotify();
		labelMsgType.setBounds(20, 20, 80, 30);
		labelMsgType.setText(confPro.getProperty("labelMsgType"));
		textMsgType.setBounds(20, 60, 80, 30);
		textMsgType.setText(confPro.getProperty("textMsgType"));
		controlPanel.add(labelMsgType);
		controlPanel.add(textMsgType);
		
		labelTranType.setBounds(130, 20, 90, 30);
		labelTranType.setText(confPro.getProperty("labelTranType"));
		textTranType.setBounds(130, 60, 90, 30);
		textTranType.setText(confPro.getProperty("textTranType"));
		controlPanel.add(labelTranType);
		controlPanel.add(textTranType);
		
		labelTraceNum.setBounds(250, 20, 90, 30);
		labelTraceNum.setText(confPro.getProperty("labelTraceNum"));
		textTraceNum.setBounds(250, 60, 90, 30);
		textTraceNum.setText(confPro.getProperty("textTraceNum"));
		controlPanel.add(labelTraceNum);
		controlPanel.add(textTraceNum);
		
		labelLocalTime.setBounds(370, 20, 90, 30);
		labelLocalTime.setText(confPro.getProperty("labelLocalTime"));
		textLocalTime.setBounds(370, 60, 90, 30);
		textLocalTime.setText(confPro.getProperty("textLocalTime"));
		controlPanel.add(labelLocalTime);
		controlPanel.add(textLocalTime);
		
		labelLocalDate.setBounds(480, 20, 90, 30);
		labelLocalDate.setText(confPro.getProperty("labelLocalDate"));
		textLocalDate.setBounds(480, 60, 90, 30);
		textLocalDate.setText(confPro.getProperty("textLocalDate"));
		controlPanel.add(labelLocalDate);
		controlPanel.add(textLocalDate);
		
		label41.setBounds(600, 20, 90, 30);
		label41.setText(confPro.getProperty("label41"));
		text41.setBounds(600, 60, 90, 30);
		text41.setText(confPro.getProperty("text41"));
		controlPanel.add(label41);
		controlPanel.add(text41);
		
		label42.setBounds(720, 20, 110, 30);
		label42.setText(confPro.getProperty("label42"));
		text42.setBounds(720, 60, 110, 30);
		text42.setText(confPro.getProperty("text42"));
		controlPanel.add(label42);
		controlPanel.add(text42);
		
		label48.setBounds(400, 250, 110, 30);
		label48.setText(confPro.getProperty("label48"));
		controlPanel.add(label48);
		
		label48_00.setBounds(20, 280, 100, 30);
		label48_00.setText(confPro.getProperty("label48_00"));
		text48_00.setBounds(20, 320, 100, 30);
		text48_00.setText(confPro.getProperty("text48_00"));
		controlPanel.add(label48_00);
		controlPanel.add(text48_00);
		
		label48_08.setBounds(150, 280, 100, 30);
		label48_08.setText(confPro.getProperty("label48_08"));
		text48_08.setBounds(150, 320, 100, 30);
		text48_08.setText(confPro.getProperty("text48_08"));
		controlPanel.add(label48_08);
		controlPanel.add(text48_08);
		
		label48_09.setBounds(280, 280, 100, 30);
		label48_09.setText(confPro.getProperty("label48_09"));
		text48_09.setBounds(280, 320, 100, 30);
		text48_09.setText(confPro.getProperty("text48_09"));
		controlPanel.add(label48_09);
		controlPanel.add(text48_09);
		
		label48_26.setBounds(410, 280, 100, 30);
		label48_26.setText(confPro.getProperty("label48_26"));
		text48_26.setBounds(410, 320, 100, 30);
		text48_26.setText(confPro.getProperty("text48_26"));
		controlPanel.add(label48_26);
		controlPanel.add(text48_26);
		
		label48_44.setBounds(540, 280, 100, 30);
		label48_44.setText(confPro.getProperty("label48_44"));
		text48_44.setBounds(540, 320, 100, 30);
		text48_44.setText(confPro.getProperty("text48_44"));
		controlPanel.add(label48_44);
		controlPanel.add(text48_44);
		
		sktButton.setBounds(400, 550, 100, 40);
		controlPanel.add(sktButton);
		addSktMsgButton.setBounds(880, 60, 100, 40);
		controlPanel.add(addSktMsgButton);
		addSktMsg48Button.setBounds(880, 310, 100, 40);
		controlPanel.add(addSktMsg48Button);
	}

}
